// Copyright (c) 2012 NetPipe
// All Rights Reserved.

/**
 * @file AnalyseChapter.h
 * 章节分析
 * @author fanpc
 * @date 2012/07/25
 * @version 1.0
 * @note Create
 * Date		     Ver	     Name	   Description
 * 20120725		 1.1.0		 fanpc	   create
 */
#ifndef ANALYSECHAPTER_H
#define ANALYSECHAPTER_H
#include <analyser/AnalyseBase.h>
#include <config/Structures.h>

#define SIZE_CONTENT_TXT 1024*1024*2

class AnalyseChapter:public AnalyseBase
{
public:
  AnalyseChapter();

  void analyseChapterInfo(chapterInfo::ChapterInfo& chapter);

  inline std::string getContentTxt()
  {
    return m_contentTxt;
  }

  inline  int getAttachSize()
  {
    return m_attachList.size();
  }

  attachInfo::AttachInfo& operator [](unsigned int index);

private:
  std::string m_contentTxt;

  std::vector<attachInfo::AttachInfo> m_attachList;

private:

  /**
      * 分析TXT文本内容
      */
  void analyseTxt();

  /**
      *分析图片内容
      */
  void analyseImage(chapterInfo::ChapterInfo& chapter);

  /**
      * 检验内容是否为图片
      */
  bool checkContentIsImage();

  void replaceMultiMatchValue(const std::string& regexName, std::string& content);
};

#endif // ANALYSECHAPTER_H
